import {get,post} from "@/api";
import {Tollgate} from "@/ts/scheme";
import sysConfig from "@/config";

const baseURL="client/tollgate"

export function getTollgateById(id:string){
    console.log('id->',id)
    return get(baseURL,"/detail",{
        id:id
    })
}

export function getTollgateListPage(schemeId:string,pageNum:number){
    return get(baseURL,"/page",{
        current:pageNum,
        size:sysConfig.PAGE_SIZE,
        schemeId:schemeId
    })
}

export function getAllTollgateList(schemeId:string){
    return get(baseURL,"/page",{
        current:1,
        size:sysConfig.NO_PAGE_SIZE,
        schemeId:schemeId
    })
}

export function addTollgate(tollgate:Tollgate){

    return post(baseURL,"/add",{
        ...tollgate
    })
}
export function updateTollgate(tollgate:Tollgate){
    return post(baseURL,"/edit",{
        ...tollgate
    })
}

export function deleteTollgate(id:string){
    return post(baseURL,"/delete",{
        id:id
    })
}